package com.gitee.huxing.course.merchant.domain.module;

import cn.hutool.core.date.DateUtil;
import com.gitee.huxing.course.merchant.utils.IDGeneratorUtil;
import com.gitee.huxing.course.merchant.utils.UUIDUtils;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 平台交易订单
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.domain.module
 * @ClassName: PlatFormOrderDO
 * @Author: huxing
 * @DateTime: 2021-09-17 下午4:33
 */
@NoArgsConstructor
@AllArgsConstructor
@Builder(toBuilder = true)
@Data
public class PlatFormOrderDO extends BaseMapperDO implements Serializable {

    private static final long serialVersionUID = -7099518472918933394L;

    /** 订单编号 **/
    private String orderId;

    /** 产品编号 **/
    private String productId;

    /** 产品名称 **/
    private String productName;

    /** 单价 **/
    private Integer price;

    /** 所属商户id **/
    private String merchantId;

    /** 所属商户名称 **/
    private String merchantName;

    /** 用户编号 **/
    private String userId;

    /** 用户姓名 **/
    private String userName;

    /** 支付记录编号 **/
    private String paymentId;

    /** 支付金额 **/
    private Integer paymentCash;

    /** 支付渠道 **/
    private String channelId;

    /** 扣款账号 **/
    private String account;

    /** 付款时间 **/
    private Date paymentTime;

    /** 订单状态 **/
    private String status;

    /** 订单发票开票记录编号 **/
    private String invoiceId;

    /** 订单配送物流编号 **/
    private String expressId;

    /**
     * @Description: 创建一个测试的记录
     * @Author: huxing
     * @return com.gitee.huxing.course.domain.module.PlatFormOrderDO
     * @Date: 2021/9/17 下午5:23
     **/
    public static PlatFormOrderDO createBuilderTest(){
        return  (PlatFormOrderDO)PlatFormOrderDO.builder()
                .orderId(IDGeneratorUtil.nextId() + "")
                .productId("3f5c7eaa55e94e3793c42ed0d962159d")
                .productName("拯救者y9000k")
                .price(1300000)
                .merchantId("a2d4b5f58b4542c4a2dc6907d84a91fa")
                .merchantName("联想京东自营旗舰店")
                .userId("e3dccd722ad44feb9adefb39cbf2dd78")
                .userName("胡星")
                .status("1")
                .build().init();
    }

    /**
     * @Description: 生成一条测试用的订单支付成功记录
     * @Author: huxing
     * @param orderId   订单编号
     * @return com.gitee.huxing.course.order.domain.module.PlatFormOrderDO
     * @Date: 2021/9/24 下午5:25
     **/
    public static PlatFormOrderDO paymentOrderTest(String orderId){
        return  (PlatFormOrderDO)PlatFormOrderDO.builder()
                .orderId(orderId)
                .paymentId(UUIDUtils.fastSimpleUUID())
                .paymentCash(1300000)
                .paymentTime(DateUtil.date())
                .invoiceId(UUIDUtils.fastSimpleUUID())
                .expressId(UUIDUtils.fastSimpleUUID())
                .status("2")
                .build().init();
    }
}
